<template>
    <div class="centre">
        <section class="inner_banner">
            <div class="picture_container">
                <img src="" title="国家中心及省站inbanner" alt="国家中心及省站inbanner" class="inner_banner_pc">
                <!-- <img src="/uploads/image/20200509/1589053199.png" title="关于我们inbanner" alt="关于我们inbanner"
                  class="inner_banner_m"> -->
            </div>
        </section>
        <div class="nav">
            <div class="center flex flex_column_center   flex_row_strat">
                <div class="flex item">
                    <i class="iconfont icon-zhuye-copy"></i>当前位置：<a href="/" title="">首页</a><span
                        class="iconfont iconyou1"></span><a href="javascript:;" title="新闻资讯" class="active"
                        onclick="return false">新闻资讯</a>
                </div>
            </div>
        </div>
        <section class="center main1 clear_float">
            <div class="inner_left">
                <div class="center">
                    <div class="left ">
                        <div class="left_monu">
                            <div class="title">
                                <p class="cn">联系我们</p>
                                <p class="en">Contact Us</p>
                            </div>
                            <div class="content">
                                <ul>
                                    <li class="" v-for="(item, index) in nationalTree" :key="index"
                                        @click="clickNationTree(item)">

                                        :title="item.title">{{ item.title }}<i
                                            class="iconfont iconzuojiantou-more el-icon-arrow-right "></i>
                                        </a>
                                    </li>
                                </ul>
                            </div>
                        </div>


                        <div class="left_tel">
                            <img src="@/images/commoncard/qualityTel.png" alt="/服务质量监督ad2" title="/服务质量监督ad2">
                        </div>
                    </div>
                </div>
            </div>
            <div class="right" id="rightContent"  v-if="rightshow">
                <div class="right_title clear_float">
                    <h3>{{ rightTitle }}</h3>
                </div>
                <div class="content rightcontent" v-html="rightcontent">

                </div>

                <!-- <div class="right_function clear_float">
                  <div class="fr flex">
                      <a href="javascript:;" id="addcollect">
                          <i class="iconfont iconshoucang"></i>
                          <p>收藏</p>
                      </a>
                      <a href="javascript:self.print();">
                          <i class="iconfont icondayin"></i>
                          <p>打印</p>
                      </a>
                      <a href="javascript:window.close();">
                          <i class="iconfont iconclose"></i>
                          <p>关闭</p>
                      </a>
                  </div>
              </div> -->
            </div>
        </section>
    </div>
</template>
<script>
import { config } from "@/common/config.js"
export default {
  data() {
      return {
          config,
          nationalTree: [],
          rightTitle:'',
          rightcontent: '',
          rightshow: false
      }
  },
  created() {
      this.init()
  },
  methods: {
      previewPic(code) {
        return config.url +config.prefix+ '/file/previewFile?code=' + code
      },
      init(){
          this.getTree()
      },
      getTree() {
          let params = {
              tenantId: 1,
              id: 2
          }
          // 获取产品树
          this.$http.get(this.$api.nationsApi.listPlateCatAndChildren, params).then(res => {
              if (res.code == 200) {
                  let result = []
                  const objArray = res.data
                  if (objArray.length > 0) {
                      for (let item of objArray) {
                          let detail = {}
                          detail.id = item.id
                          detail.title = item.title
                          detail.bgPic = this.previewPic(item.bgPic)
                          result.push(detail)
                      }
                  }
                  this.nationalTree = result

              }
          })
      },
      clickNationTree(data) {
          this.rightTitle = data.title
          this.getdetail(data.id)
      },
       //获取右边详情
       getdetail(data) {
          let params = {
              id: data
          }
          let _that = this
          this.$http.get(this.$api.nationsApi.getProdInfo, params).then(res => {
              if (res.code == 200) {
                  _that.rightcontent = res.data.intro
                  _that.rightshow = true

              }
          })
      }
  }
}
</script>
<style scoped>@import '@/styles/index.scss';</style>